<template>
  <div class="card" :class="{ 'card--full': full, 'card--scrollbar': scrollbar }">
    <div class="card-head">
      <div class="card-title">{{ title }}</div>
    </div>
    <div class="card-body">
      <template v-if="scrollbar">
        <el-scrollbar> <slot></slot></el-scrollbar>
      </template>
      <slot v-else> </slot>
    </div>
    <div class="card-footer" v-if="$slots.footer">
      <slot name="footer"></slot>
    </div>
  </div>
</template>
<script setup>
const props = defineProps({
  title: String,
  full: Boolean,
  scrollbar: Boolean,
})
</script>
<style lang="scss" scoped>
.card {
  background-color: #fff;
  box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  height: 100%;
  overflow: hidden;
}

.card-body {
  padding: 0 24px 24px 24px;
}

.card--full {
  display: flex;
  flex-direction: column;
  .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
}

.card-head {
  padding: 24px 24px 16px 24px;
  .card-title {
    font-size: 18px;
    font-weight: bold;
  }
}

.card--flex {
  display: flex;
  flex-direction: column;
  .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
}
</style>
